
<html lang="en">
<head>
    <link rel="stylesheet" type="text/css" href="/public/hui/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/public/hui/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/public/hui/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/public/hui/static/h-ui.admin/css/style.css" />
</head>
<body>
<article class="cl pd-20  col-xs-10 col-xs-offset-1">
    <form action="" method="post" class="form form-horizontal" id="form">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">* </span>分类名称</label>
            <div class="formControls col-xs-9 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="classify_name" name="classify_name">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">* </span>上级模块：</label>
            <div class="formControls col-xs-9 col-sm-9">
                <span class="select-box">
                <select class="select" size="1" name="group_id">
                    <option value="">暂不分配</option>
                    <? foreach ($modules as $k=>$v):?>
                        <option value="<?=$v['id']?>"><?=$v['name']?></option>
                    <? endforeach;?>
                </select>
                </span>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">* </span>路由</label>
            <div class="formControls col-xs-9 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="route" name="route">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">* </span>方法</label>
            <div class="formControls col-xs-9 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="func" name="func">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">&nbsp;&nbsp;排序</label>
            <div class="formControls col-xs-9 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="0" id="sort" name="sort">
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-3 col-xs-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;增加&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>
<script type="text/javascript" src="/public/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="/public/lib/layer/layer.js"></script>
<script type="text/javascript" src="/public/hui/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="/public/hui/static/h-ui.admin/js/H-ui.admin.page.js"></script>
<script type="text/javascript" src="/public/lib/validate/jquery.validate.min.js"></script>
<script>

    $("#form").validate({
        rules:{
            classify_name:{
                required:true,
                minlength:1
            },
            group_id:{
                required:true
            },
            route:{
                required:true
            },
            func:{
                required:true
            }
        },
        onkeyup:false,
        focusCleanup:true,
        success:"valid",
        submitHandler:function(form){
            $.ajax({
                dataType:'json',
                type: 'post',
                url: '/Systems/classify_do',
                data: $('#form').serialize(),
                success: function(data){
                    if(1 == data){
                        layer.msg('操作成功!', {
                            icon: 1,
                            time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        }, function(){
                            parent.layer.closeAll();
                        });
                    }else{
                        layer.msg('操作失败!');
                    }
                }
            });
        }
    });
</script>
</body>
</html>